from flask import *
import requests

app = Flask(__name__)


@app.before_request
def proxy():
    headers = {h[0]: h[1] for h in request.headers}
    # url = request.url
    url = 'http://localhost:8081'
    print(request)
    return requests.request(request.method, url, data=request.json, headers=headers).content


if __name__ == '__main__':
    app.run('0.0.0.0', port=8082, debug=False)